#include "my_http_base.h"

my_str_t my_http_host_hdr_name = {
    .len = MY_HTTP_HOST_HDR_LEN,
    .data = MY_HTTP_HOST_HDR
};

my_str_t my_http_connection_hdr_name = {
    .len = MY_HTTP_CONNECTION_HDR_LEN,
    .data = MY_HTTP_CONNECTION_HDR
};

my_str_t my_http_cl_hdr_name = {
    .len = MY_HTTP_CL_HDR_LEN,
    .data = MY_HTTP_CL_HDR
};

my_str_t my_http_range_hdr_name = {
    .len = MY_HTTP_RANGE_HDR_LEN,
    .data = MY_HTTP_RANGE_HDR
};

my_str_t my_http_te_hdr_name = {
    .len = MY_HTTP_TE_HDR_LEN,
    .data = MY_HTTP_TE_HDR
};


my_str_t my_http_version_10_str = {
    .len = MY_HTTP_VERSION_10_STR_LEN,
    .data = MY_HTTP_VERSION_10_STR
};

my_str_t my_http_version_11_str = {
    .len = MY_HTTP_VERSION_11_STR_LEN,
    .data = MY_HTTP_VERSION_11_STR
};


my_str_t my_http_continue_reason = {
    .len = sizeof("Continue") - 1,
    .data = "Continue"
};

my_str_t my_http_switching_protocols_reason = {
    .len = sizeof("Switching Protocols") - 1,
    .data = "Switching Protocols"
};

my_str_t my_http_processing_reason = {
    .len = sizeof("Processing") - 1,
    .data = "Processing"
};

my_str_t my_http_ok_reason = {
    .len = sizeof("Ok") - 1,
    .data = "Ok"
};

my_str_t my_http_created_reason = {
    .len = sizeof("Created") - 1,
    .data = "Created"
};

my_str_t my_http_accepted_reason = {
    .len = sizeof("Accepted") - 1,
    .data = "Accepted"
};

my_str_t my_http_no_content_reason = {
    .len = sizeof("No Content") - 1,
    .data = "No Content"
};

my_str_t my_http_partial_content_reason = {
    .len = sizeof("Partial Content") - 1,
    .data = "Partial Content"
};

my_str_t my_http_multiple_choices_reason = {
    .len = sizeof("Multiple Choices") - 1,
    .data = "Multiple Choices"
};

my_str_t my_http_moved_permanently_reason = {
    .len = sizeof("Moved Permanently") - 1,
    .data = "Moved Permanently"
};

my_str_t my_http_moved_temporarily_reason = {
    .len = sizeof("Moved Temporarily") - 1,
    .data = "Moved Temporarily"
};

my_str_t my_http_not_modified_reason = {
    .len = sizeof("Not Modified") - 1,
    .data = "Not Modified"
};

my_str_t my_http_temporary_redirect_reason = {
    .len = sizeof("Temporary Redirect") - 1,
    .data = "Temporary Redirect"
};

my_str_t my_http_permanent_redirect_reason = {
    .len = sizeof("Permanent Redirect") - 1,
    .data = "Permanent Redirect"
};

my_str_t my_http_bad_request_reason = {
    .len = sizeof("Bad Request") - 1,
    .data = "Bad Request"
};

my_str_t my_http_unauthorized_reason = {
    .len = sizeof("Unauthorized") - 1,
    .data = "Unauthorized"
};

my_str_t my_http_forbidden_reason = {
    .len = sizeof("Forbidden") - 1,
    .data = "Forbidden"
};

my_str_t my_http_not_found_reason = {
    .len = sizeof("Not Found") - 1,
    .data = "Not Found"
};

my_str_t my_http_not_allowed_reason = {
    .len = sizeof("Not Allowed") - 1,
    .data = "Not Allowed"
};

my_str_t my_http_request_time_out_reason = {
    .len = sizeof("Request Time-out") - 1,
    .data = "Request Time-out"
};

my_str_t my_http_length_required_reason = {
    .len = sizeof("Length Required") - 1,
    .data = "Length Required"
};

my_str_t my_http_request_entiry_too_large_reason = {
    .len = sizeof("Request Entity Too Large") - 1,
    .data = "Request Entity Too Large"
};

my_str_t my_http_request_uri_too_large_reason = {
    .len = sizeof("Request-URI Too Large") - 1,
    .data = "Request-URI Too Large"
};

my_str_t my_http_range_not_satisfiable_reason = {
    .len = sizeof("Requested Range Not Satisfiable") - 1,
    .data = "Requested Range Not Satisfiable"
};

my_str_t my_http_too_many_requests_reason = {
    .len = sizeof("Too Many Requests") - 1,
    .data = "Too Many Requests"
};

my_str_t my_http_internal_server_error_reason = {
    .len = sizeof("Internal Server Error") - 1,
    .data = "Internal Server Error"
};

my_str_t my_http_not_implemented_reason = {
    .len = sizeof("Not Implemented") - 1,
    .data = "Not Implemented"
};

my_str_t my_http_bad_gateway_reason = {
    .len = sizeof("Bad Gateway") - 1,
    .data = "Bad Gateway"
};

my_str_t my_http_service_unavaliable_reason = {
    .len = sizeof("Service Temporarily Unavailable") - 1,
    .data = "Service Temporarily Unavailable"
};

my_str_t my_http_gateway_time_out = {
    .len = sizeof("Gateway Time-out") - 1,
    .data = "Gateway Time-out"
};

my_str_t my_http_version_not_supported_reason = {
    .len = sizeof("HTTP Version Not Supported") - 1,
    .data = "HTTP Version Not Supported"
};

my_str_t my_http_unknow_reason = {
    .len = sizeof("Unknow") - 1,
    .data = "Unknow"
};

my_str_t *
my_http_get_response_reason(int status_code)
{
    switch (status_code) {
    case MY_HTTP_CONTINUE:
        return &my_http_continue_reason;
    case MY_HTTP_SWITCHING_PROTOCOLS:
        return &my_http_switching_protocols_reason;
    case MY_HTTP_PROCESSING:
        return &my_http_processing_reason;
    case MY_HTTP_OK:
        return &my_http_ok_reason;
    case MY_HTTP_CREATED:
        return &my_http_created_reason;
    case MY_HTTP_ACCEPTED:
        return &my_http_accepted_reason;
    case MY_HTTP_NO_CONTENT:
        return &my_http_no_content_reason;
    case MY_HTTP_PARTIAL_CONTENT:
        return &my_http_partial_content_reason;
    case MY_HTTP_MULTIPLE_CHOICES:
        return &my_http_multiple_choices_reason;
    case MY_HTTP_MOVED_PERMANENTLY:
        return &my_http_moved_permanently_reason;
    case MY_HTTP_MOVED_TEMPORARILY:
        return &my_http_moved_temporarily_reason;
    case MY_HTTP_NOT_MODIFIED:
        return &my_http_not_modified_reason;
    case MY_HTTP_TEMPORARY_REDIRECT:
        return &my_http_temporary_redirect_reason;
    case MY_HTTP_PERMANENT_REDIRECT:
        return &my_http_permanent_redirect_reason;
    case MY_HTTP_BAD_REQUEST:
        return &my_http_bad_request_reason;
    case MY_HTTP_UNAUTHORIZED:
        return &my_http_unauthorized_reason;
    case MY_HTTP_FORBIDDEN:
        return &my_http_forbidden_reason;
    case MY_HTTP_NOT_FOUND:
        return &my_http_not_found_reason;
    case MY_HTTP_NOT_ALLOWED:
        return &my_http_not_allowed_reason;
    case MY_HTTP_REQUEST_TIME_OUT:
        return &my_http_request_time_out_reason;
    case MY_HTTP_LENGTH_REQUIRED:
        return &my_http_length_required_reason;
    case MY_HTTP_REQUEST_ENTITY_TOO_LARGE:
        return &my_http_request_entiry_too_large_reason;
    case MY_HTTP_REQUEST_URI_TOO_LARGE:
        return &my_http_request_uri_too_large_reason;
    case MY_HTTP_RANGE_NOT_SATISFIABLE:
        return &my_http_range_not_satisfiable_reason;
    case MY_HTTP_TOO_MANY_REQUESTS:
        return &my_http_too_many_requests_reason;
    case MY_HTTP_INTERNAL_SERVER_ERROR:
        return &my_http_internal_server_error_reason;
    case MY_HTTP_NOT_IMPLEMENTED:
        return &my_http_not_implemented_reason;
    case MY_HTTP_BAD_GATEWAY:
        return &my_http_bad_gateway_reason;
    case MY_HTTP_SERVICE_UNAVAILABLE:
        return &my_http_service_unavaliable_reason;
    case MY_HTTP_GATEWAY_TIME_OUT:
        return &my_http_gateway_time_out;
    case MY_HTTP_VERSION_NOT_SUPPORTED:
        return &my_http_version_not_supported_reason;
    default:
        return &my_http_unknow_reason;
    }
}